<?php
/**
 * Created by PhpStorm.
 * User: Sergey
 * Date: 22.02.14
 * Time: 16:22
 */

/**
 * Class Config
 */
class Config
{
    private $tablesPrefix;

    private $groupsTableName;
    private $quizzesTableName;
    private $questionsTableName;
    private $answersTableName;
    private $resultsTableName;

    private $relQuizToGroupsTableName;
    private $relTutorToGroupsTableName;
    private $relStudentToGroupTableName;

    private static $instance;

    /**
     * Default constructor
     */
    public function __construct()
    {
        $this->tablesPrefix = "dq_";

        $this->groupsTableName = $this->tablesPrefix . "groups";
        $this->quizzesTableName = $this->tablesPrefix . "quizzes";
        $this->questionsTableName = $this->tablesPrefix . "questions";
        $this->answersTableName = $this->tablesPrefix . "answers";
        $this->resultsTableName = $this->tablesPrefix . "results";

        $this->relQuizToGroupsTableName = $this->tablesPrefix . "rel_quiz_to_groups";
        $this->relTutorToGroupsTableName = $this->tablesPrefix . "rel_tutor_to_groups";
        $this->relStudentToGroupTableName = $this->tablesPrefix . "rel_student_to_group";
    }

    public static function get()
    {
        if (!self::$instance) {
            self::$instance = new Config();
        }
        return self::$instance;
    }

    /**
     * @return string
     */
    public function getTablesPrefix()
    {
        return $this->tablesPrefix;
    }

    /**
     * @return string
     */
    public function getGroupsTableName()
    {
        return $this->groupsTableName;
    }

    /**
     * @return mixed
     */
    public function getQuizzesTableName()
    {
        return $this->quizzesTableName;
    }

    /**
     * @return mixed
     */
    public function getQuestionsTableName()
    {
        return $this->questionsTableName;
    }

    /**
     * @return mixed
     */
    public function getAnswersTableName()
    {
        return $this->answersTableName;
    }

    /**
     * @return string
     */
    public function getResultsTableName()
    {
        return $this->resultsTableName;
    }

    /**
     * @return string
     */
    public function getRelQuizToGroupsTableName()
    {
        return $this->relQuizToGroupsTableName;
    }

    /**
     * @return string
     */
    public function getRelTutorToGroupsTableName()
    {
        return $this->relTutorToGroupsTableName;
    }

    /**
     * @return string
     */
    public function getRelStudentToGroupTableName()
    {
        return $this->relStudentToGroupTableName;
    }
}